package com.sjq.bean;

import com.sjq.db.Dbutil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class User {

    public boolean check(String userid,String pwd)throws Exception{
        Dbutil dbUtil=new Dbutil();
        Connection conn=dbUtil.getConn();
        PreparedStatement pstmt=null;
        ResultSet rs=null;
        String sql="select * from medical user where userid=? and password=?";

        try{
            pstmt=conn.prepareStatement(sql);
            pstmt.setString(1,userid);
            pstmt.setString(2,pwd);
            rs=pstmt.executeQuery();
            return rs.next();
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }finally {
            dbUtil.close(rs,pstmt,conn);
        }
    }

}
